@extends('admin.container')

@section('c-head')
    <script type="text/javascript">
        var PAGE_DATA = {
            // 编辑
            @if(isset($admin))
            DEFAULT: {
                user: "{{ $admin->user }}", //分类名称
                email: "{{ $admin->email }}", //电子邮箱
                roles: $.parseJSON('{{ $admin->roles()->lists('id')->toJson() }}') //分类
            },
            @else
            DEFAULT: null,
            @endif
            REST_API: {
                adminClassily: "{{ route('admin.role.index') }}", //管理员组
            }

        };
    </script>
@stop

@section('c-body')
    <div class="comm-title">
        <span class="title-msg" id="page-nav">权限  > 管理员管理 > 编辑</span>
    </div>
    <div class="comm-body">
        <form id="admin_editor" style="margin-top: 20px;" action="@if(isset($admin)){{ route('admin.admin.update', [$admin->id]) }}@else {{ route('admin.admin.index') }}@endif" method="post">
            {{ csrf_field() }}
            @if(isset($admin)) <input name="_method" value="PUT" hidden="hidden"> @endif
            <div class="clearfix wbb">
                <div class="form-left fl tr" style="width: 10%">管理员名：</div>
                <div class="form-right fl">
                    <input type="text" name="user" id="user">
                </div>
            </div>
            <div class="clearfix mt10 wbb">
                <div class="form-left fl tr" style="width: 10%">电子邮件：</div>
                <div class="form-right fl">
                    <input type="text" name="email" id="email">
                </div>
            </div>
            <div class="clearfix mt10 wbb">
                <div class="form-left fl tr" style="width: 10%">密码：</div>
                <div class="form-right fl">
                    <input id="password" type="password" name="password">
                </div>
            </div>
            <div class="clearfix mt10 wbb">
                <div class="form-left fl tr" style="width: 10%">确认密码：</div>
                <div class="form-right fl">
                    <input type="password" name="sure_password">
                </div>
            </div>
            <div class="clearfix mt10 wbb">
                <div class="form-left fl tr" style="width: 10%">所属管理组：</div>
                <div class="form-right fl" id="classily">
                </div>
            </div>
            <div class="clearfix mt30" style="width:43%;">
                <div class="form-left fl tr" style="width: 10%"></div>
                <div class="form-right fl">
                    <input type="submit" class="am-btn am-btn-secondary" style="width: auto;height: auto;">
                    <input type="reset" class="am-btn am-btn-default" value="重置" style="width: auto;height: auto;">
                </div>
            </div>
        </form>
    </div>

    <script type="text/template" id="roleListTemplate">
        <%_.each(obj, function(item){%>
        <span class="ml20">
                <input type="radio" id="<%=item.id%>" style="width: auto;height: auto;" data-role-id="<%=item.id%>" value="<%=item.id%>" name="role[]">
                <label for="<%=item.id%>"><%=item.username%></label>
            </span>
        <%})%>
    </script>
    <script src="/assets/b2b/admin/js/jquery.min.js"></script>
    <!--<![endif]-->
    <script src="/assets/b2b/admin/js/amazeui.js"></script>
    <script src="/assets/b2b/admin/js/libs/underscore-min.js"></script>
    <script src="/assets/b2b/admin/js/libs/jquery-ui.min.js"></script>
    <script src="/assets/b2b/admin/js/libs/jquery.validate.min.js"></script>
    <script src="/assets/b2b/admin/js/libs/messages_zh.js"></script>
    <script src="/assets/b2b/admin/js/libs/util-admin.js"></script>
    <script src="/assets/b2b/admin/js/pages/29.30.js"></script>
@stop